// pages/page5/page5.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
      opacity: 1,
      disabled: false,
      max: 30,
      min: 26,
      rule: 'up',
      items: [
        { name: 'up', value: '让巴西龟晒晒太阳', checked: 'ture' },
        { name: 'down', value: '让巴西龟回到阴凉处' },
      ]
    },
  
    radioChange: function (e) {
      //保存报警规则到当前页面的数据
      if (e.detail.value != "") {
        this.setData({
          rule: e.detail.value
        })
      }
      console.log(this.data.rule)
    },
  
    feed: function () {
        wx.showModal({
            title: '',
            content: `爬宠对您的依赖度增加了！`
        })
    },

    observe: function () {
        wx.showModal({
            title: '',
            content: `爬宠对您的信任度增加了！`
        })
    },

    play: function () {
        wx.showModal({
            title: '',
            content: `互动太频繁啦，请让爬宠休息一会`
        })
    },
      change: function (e) {
        //当有输入时激活发送按钮，无输入则禁用按钮
        if (e.detail.value != "") {
          this.setData({
            threshold: e.detail.value,
            opacity: 1,
            disabled: false,
          })
        } else {
          this.setData({
            threshold: 0,
            opacity: 1,
            disabled: false,
          })
        }
      }
    })